#include "uninstall.h"
#include "ui_uninstall.h"
#include "quanju.h"
uninstall::uninstall(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::uninstall)
{
    ui->setupUi(this);
}

uninstall::~uninstall()
{
    delete ui;
}

void uninstall::on_pushButton_clicked()
{
    this->hide();
}

void uninstall::on_pushButton_2_clicked()
{
    QString addr;
    addr = func_findaddr(softwarename);
    qDebug()<<addr;
    QDir qdir(addr);
    if(qdir.removeRecursively()){
        QString sql =QString("delete from user where SoftwareName='%1'").arg(softwarename);
        QSqlQuery query;
        bool ok = query.exec(sql);
        if(!ok)
        {
            qDebug()<<query.lastError();
        }
        this->hide();
        QMessageBox::information(NULL,"infor","delete success!");
    }
}
